﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MyToolkit.Com
{
    public class TypeHelper
    {
        public static string GetCSharpType(string dbType)
        {
            switch (dbType.ToLower())
            {
                case "datetime":
                    return "DateTime";
                case "varchar":
                case "nvarchar":
                case "char":
                case "nchar":
                case "text":
                case "ntext":
                case "date":
                case "time":
                case "xml":
                    return "string";
                case "uniqueidentifier":
                    return "Guid";
                case "bigint":
                    return "long";
                case "int":
                    return "int";
                case "smallint":
                    return "short";
                case "tinyint":
                    return "Byte";
                case "decimal":
                case "money":
                case "numeric":
                    return "decimal";
                case "image":
                    return "byte[]";
                case "float":
                    return "double";
                case "bit":
                    return "bool";
                default:
                    return "Object";
            }
        }
    }
}
